#include <iostream>
using namespace std;

int maxSubArray(int A[], int n) {
    // Start typing your C/C++ solution below
    // DO NOT write int main() function
    int max = A[0];
    int last = A[0];
    for(int i=1; i<n; ++i){
        last = last> 0? last + A[i] : A[i];
        if(last > max){
            max = last;
        }
    }
    return max;
}


int main(){

    return 0;
}